<?php
namespace App\Models\Requests;

class SurveyQuestionRequest extends BaseRequest
{
    public function rules()
    {
        switch ($this->method()) {
            case 'GET':
            {
                return [
                    'id' => ['required']
                ];
            }
            case 'POST':
            {
                return [
                    'name' => ['required', 'string', 'max:255','min:4'],
                ];
            }
            case 'PUT':
            case 'PATCH':
            case 'DELETE':
            default:
            {
                return [

                ];
            }
        }
    }

    public function messages()
    {
        return [
            'id.required' => '问题ID必须填写',
            'id.exists' => '问题不存在',
            'name.required' => '问卷调查不能为空',
            'name.max' => '问卷调查最大长度为255个字符',
            'name.min' => '问卷调查最小长度为4个字符',
        ];
    }
}
